<%@ include file="/en/jsp/static.jsp" %>
<%@ page import="java.util.*,linuxbox.news.logic.*,linuxbox.BoxStatic" %>

  <table width="100%" border=1 cellpadding=2 cellspacing=0 bgColor=#dddddd>
  <tr>
    <td bgcolor="#dddddd" height="20">
      <table width="100%" border=0 cellpadding=2 cellspacing=0 bgColor=#dddddd>
        <tr>
          <td>
            <p align="center"><b><font color=#d05000>The latesd news</font></b></p>
          </td>
          <td align=right>
            <a href="<%=BoxStatic.jspDir%>news/BoxNews.jsp">More news...</a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
<%
  BoxNews2 home = BoxNews2.getInstance();
  int entriesPerPage = sec.getConfigInt("news", "HomePage", "Entries Per HomePage");
  int length = sec.getConfigInt("news", "HomePage", "Length");

  List<BoxNewsEntry> newsList = home.getNews(BoxNews2.VT_CURRENT,
                       BoxNews2.ORDER_BY_SUBTIME, true, 0, entriesPerPage);
  if (newsList != null) {
    for(BoxNewsEntry entry : newsList) {
      out.println("<tr><td bgcolor=#ffffff colspan=2 >[" + entry.getSubTimeString()+"] <b>" + entry.getSubject()+ "</b><br>");
      String s = entry.getContent();
      if (s.length() > 200) {
        out.println(s.substring(0, length));
        out.print("...");
      } else {
        out.print(s);
      }

      out.print("</td></tr>");
    }
  } else
    out.println("<tr><td>No news</td></tr>");
%>
  </table>